const express = require("express")
const router = express.Router()
const journalDB = require("../../../../db/journal")


// 获取日志
router.get("/get", async (req, res) => {
  try {
    let doc = await journalDB.find({}, {}, { sort: { date: -1 } }).populate("author", { Supertube: 0, admin: 0, pass: 0 })
    res.send({
      code: 0,
      mes: "日志列表",
      data: doc
    })
  } catch (error) {
    res.send({
      code: 5,
      mes: "服务器异常，请稍后再试"
    })
  }
})

// 日志的修改
router.use("/update", require("./update"))

// 日志的删除
router.use("/delete", require("./delete"))


module.exports = router